package com.adgox.tiantianbiting.widget;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Created by tang on 2018/12/18.
 */

public class FragmentContainer extends ViewPager {

    //禁止左右滑动
    private  boolean isScrollingEnable = false;

    public FragmentContainer(Context context) {
        super(context);
    }

    public FragmentContainer(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        return this.isScrollingEnable&&super.onTouchEvent(ev);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        return this.isScrollingEnable&&super.onInterceptTouchEvent(ev);
    }

    public void setScrollingEnable(boolean canScroll){
        this.isScrollingEnable = canScroll;
    }
}
